package com.ycy;

import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;

import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.math.BigDecimal;
import java.util.List;

public class ExcelDemo22 {

    /**
     * 按照 index 读取成 业务对象集合
     * 参考官网文档
     * https://easyexcel.opensource.alibaba.com/docs/3.0.x/quickstart/read#%E6%8C%87%E5%AE%9A%E5%88%97%E7%9A%84%E4%B8%8B%E6%A0%87%E6%88%96%E8%80%85%E5%88%97%E5%90%8D
     *
     */
    public static void main1(String[] args) throws FileNotFoundException {

        String filePath = "C:\\Users\\yincaiyong\\模板20240517a(包括导入及导出模板）\\导入模板\\居住区（村庄）台账导入模板.xlsx";


        List<RaInfoV2ForVillageUploadForCommonUploadExcel> list = EasyExcel.read(new FileInputStream(filePath))
                .head(RaInfoV2ForVillageUploadForCommonUploadExcel.class)
                .sheet(0).headRowNumber(4)
                .doReadSync();

        System.out.println(JSONUtil.toJsonStr(list));

        /*
        console

        [{"address":"1","code":"11","entName":"4","checkConcentrationDeviceCount":"17","diaphragmGasFlowMeterCount":"21","latitude":24,
        "gcPlCount":"15","reportAndCloseDeviceCount":"18","remark":"25","gcBtCount":"16","iocGasFlowMeterCount":"22","resCount":"14",
        "icGasFlowMeterCount":"20","codeExtsys":"13","vaillageName":"10","streetOffice":"8","smartCloseDeviceCount":"19","name":"9",
        "alias":"12","region":"7","longitude":23}]
         */

    }

    public static void main(String[] args) throws FileNotFoundException {
        String filePath = "C:\\Users\\yincaiyong\\Downloads\\管线分段导入模板.xlsx";

        BigDecimal obj = new BigDecimal("0");
        System.out.println(String.valueOf(obj));


//        List<PlSectionExcel> list = EasyExcel.read(new FileInputStream(filePath))
//                .head(PlSectionExcel.class)
//                .sheet(0).headRowNumber(1)
//                .doReadSync();
//        for (int i = 1; i < list.size(); i++) {
//            System.out.println(list.get(i).getHeight());
//            BigDecimal bigDecimal = new BigDecimal(list.get(i).getHeight());
//            System.out.println(bigDecimal);
//        }
//
//
//
//        System.out.println(JSONUtil.toJsonStr(list));
    }


}
